package com.example.starseas_phone.Adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.starseas_phone.Entity.Alerts;
import com.example.starseas_phone.R;

import java.util.List;

public class Alerts_listviewAdapter extends ArrayAdapter<Alerts> {

    private int id;

    public Alerts_listviewAdapter(@NonNull Context context, int resource, @NonNull List<Alerts> objects) {
        super(context, resource, objects);
        id = resource;
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        Alerts alerts = getItem(position);
        View view = LayoutInflater.from(parent.getContext()).inflate(id,parent,false);
        TextView alerts_listview_title = (TextView) view.findViewById(R.id.alerts_listview_title);
        TextView alerts_listview_Content = (TextView) view.findViewById(R.id.alerts_listview_Content);
        TextView alerts_listview_WorkerName = (TextView)view.findViewById(R.id.alerts_listview_WorkerName);

        alerts_listview_title.setText(alerts.getAlerts_Title());
        alerts_listview_Content.setText("\u3000\u3000"+alerts.getAlerts_Content());
        alerts_listview_WorkerName.setText(alerts.getWorkerName());

        return view;
    }
}
